package com.anlu.base.model;

import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

@Getter
@Setter
public class FzTicket {
    /**
     * 时间戳 时间戳与业务无关,务必存在
     */
    private Long ts = 0L;

    /**
     * token 和各个业务相关的验证方式
     */
    private String t = "";
    /**
     * appName = regionId(uuid去掉横线) +"_"+ serviceId +"_"+ 容器名称(application{编号})
     *
     */
    private String an = "";
    /**
     * 签订tk的slug
     */
    private String slug = "";
    /**
     * 业务id，用于业务签名
     */
    private String bizId = "";

    public FzTicket() {

    }

    public FzTicket(Long ts, String t, String an) {
        this.ts = ts;
        this.t = t;
        this.an = an;
    }

    public FzTicket(Long ts, String t, String an, String slug) {
        this.ts = ts;
        this.t = t;
        this.an = an;
        this.slug = slug;
    }

    public FzTicket(Long ts, String t, String an, String slug, String bizId) {
        this.ts = ts;
        this.t = t;
        this.an = an;
        this.slug = slug;
        this.bizId = bizId;
    }



    /**
     * 方法描述：生成 tk String
     *
     * @param
     * @return java.lang.String
     * @author 赵希坤
     * @date 日期：2024/2/27 时间：20:27
     */

    public static FzTicket newInstance() {
        return new FzTicket();
    }

    public FzTicket t(String t) {
        this.t = t;
        return this;
    }

    public FzTicket an(String an) {
        this.an = an;
        return this;
    }

    public FzTicket ts(Long ts) {
        this.ts = ts;
        return this;
    }

    public FzTicket slug(String slug) {
        this.slug = Objects.toString(slug, "");
        return this;
    }

    public FzTicket bizId(String bizId) {
        this.bizId = Objects.toString(bizId, "");
        return this;
    }
}
